# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    lineCnt = int(input())
    paths = []
    for i in range(lineCnt):
        urlPath = input()
        # print(urlPath)
        paths.append(urlPath)
    lastLineArr = input().split()
    deepNum = int(lastLineArr[0])
    res = 0
    for path in paths:
        pathArr = path.split("/")
        if len(pathArr) > deepNum and pathArr[deepNum] == lastLineArr[1]:
            res += 1

    print(res)
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
"""
5
/huawei/computing/no/one
/huawei/computing
/huawei
/huawei/cloud/no/one
/huawei/wireless/no/one
4 11
"""